/** ================================
 * 模块：${bean.notesMain} ---- ${bean.notesSub} T${bean.numMain}${bean.numSub}
 * ================================
 * 一、更新说明：
 * V1.0.0(${bean.numTime}) ${bean.author} 初版。
 */
define( [
        'components/baseModel/BaseModel'
        ],
    function(BaseModel) {
    /**
     * 定义模块数据模型
     */
    var _Model = BaseModel.extend({
         /**
         * 初始化界面显示
         */
        initDispalyParam:function(){
            var _this = this;
    		//系统代码
         <#if (bean.systemCodeList)?size!=0>
             <#list (bean.systemCodeList) as codeOption>
                 <#if (codeOption.codeId)!='branchId'>
            var options_${codeOption.codeId} = Util.getCode("${codeOption.codeType}");//${codeOption.codeId}
                 </#if>
                 <#if (codeOption.codeId)=='warehouseId'||(codeOption.codeId)?contains("warehouse")>
             //仓库Id二级窗口
            var dialog_warehouseId=_this.initDialog_warehouse();
                 </#if>
                 <#if (codeOption.codeId)=='customerId'>
             //客户编号二级窗口
            var dialog_customerId=_this.initDialog_customer("OW");
                     //承运商二级窗口
                     var initDialog_carrier = _this.initDialog_carrier();
                 </#if>
                 <#if (codeOption.codeId)=='carrierId'||(codeOption.codeId)?contains("carrier")>
             //承运商二级窗口
            var initDialog_carrier = _this.initDialog_carrier();
                 </#if>
                 <#if (codeOption.codeId)=='branchId'>
            var options_branchId = {
                     onClick:function(e){
                     require([Util.getDialogDomain('A05DIG06_BRANCH').url], function (subModule) {
                     subModule.showWindow({
                     id: "A05DIG06_BRANCH",
                     namespace:_this.namespace,
                     callback:{
                         onConfirm:function(selectedId,item){
                         FLUXWMS.vent.trigger('setItemValue:'+_this.namespace+_this.searchForm+':form','${codeOption.codeId}',selectedId);
                              }
                     }
                    });
                });
             }
                 </#if>
             </#list>
         </#if>
<#list (bean.otherCodeList) as otherCode>
        <#if (otherCode.codeId)=='warehouseId'||(otherCode.codeId)?contains("warehouse")>
            //仓库Id二级窗口
            var dialog_warehouseId=_this.initDialog_warehouse();
        </#if>
        <#if (otherCode.codeId)=='customerId'>
            //客户编号二级窗口
            var dialog_customerId=_this.initDialog_customer("OW");
        </#if>
        <#if (otherCode.codeId)=='carrierId'||(otherCode.codeId)?contains("carrier")||(otherCode.codeId)?contains("carri")||(otherCode.codeId)?contains("Carri")>
            //承运商二级窗口
            var initDialog_carrier = _this.initDialog_carrier();
        </#if>
</#list>

            //查询界面
    		this.searchFormData=[
    			                  { type: "settings",position: "label-left",inputWidth: "col-sm-100" },
    			                    { type: "block",id: _this.namespace+"searchRegionForm", list: 
    		    	                 [
                               <#list (bean.searchPk01)! as searchBeanId>
                                        <#if (searchBeanId.type)=='combo'>
                                       { type: "combo", label: this.mlh.getDescr("H1", "${searchBeanId.name}"),    name: "${searchBeanId.name}",  value: "",options:options_${searchBeanId.name}}, //
                                        </#if>
                                        <#if (searchBeanId.type)=='input'>
                                       { type: "input", label: this.mlh.getDescr("H1", "${searchBeanId.name}"),    name: "${searchBeanId.name}",  value: "",upperCase:true}, //
                                        </#if>
                                        <#if (searchBeanId.type)=='checkBox'>
                                       { type: "checkbox",label: this.mlh.getDescr("H1", "${searchBeanId.name}"),	name: "${searchBeanId.name}",checked:"true"},
                                        </#if>
                                       </#list>
<#--<#list (bean.otherCodeList)! as searchBeanId>-->
                                       <#--{ type: "input", label: this.mlh.getDescr("H1", "${searchBeanId.codeId}"),    name: "${searchBeanId.codeId}",  value: "",upperCase:true}, //-->
<#--</#list>-->
    		    	                 ]
    			                 }];

            //主列表
            this.gridColumns=[
                    <#list 0..(bean.gridList)?size-1! as i>
                        <#if (bean.gridList[i])?contains("")>
                                {id: "${bean.gridList[i]}",label:this.mlh.getDescr("H1", "${bean.gridList[i]}") }, //${bean.gridListDesc[i]}
                        <#elseif (bean.gridList[i])?contains("")>
                                {id: "${bean.gridList[i]}",label:this.mlh.getDescr("H1", "${bean.gridList[i]}") },//${bean.gridListDesc[i]}
                        <#else>
                                {id: "${bean.gridList[i]}",label:this.mlh.getDescr("H1", "${bean.gridList[i]}") },//${bean.gridListDesc[i]}
                        </#if>
                  </#list>
                                {id: "udf01", label: this.mlh.getDescr("H1", "udf01")},//自定义01
                                {id: "udf02", label: this.mlh.getDescr("H1", "udf02")},
                                {id: "udf03", label: this.mlh.getDescr("H1", "udf03")},
                                {id: "udf04", label: this.mlh.getDescr("H1", "udf04")},
                                {id: "udf05", label: this.mlh.getDescr("H1", "udf05")},
                             // {id: "udf06", label: this.mlh.getDescr("H1", "udf06")},
                             // {id: "udf07", label: this.mlh.getDescr("H1", "udf07")},
                             // {id: "udf08", label: this.mlh.getDescr("H1", "udf08")},
                             // {id: "udf09", label: this.mlh.getDescr("H1", "udf09")},
                             // {id: "udf10", label: this.mlh.getDescr("H1", "udf10")}
             ];
            this.formItems = [{ type: "settings",position: "label-left",inputWidth: "col-sm-25"},
    			             //主信息
			    			 { type: "block",id: _this.namespace + "headerMainForm",label: this.mlh.getText("mainInfo"),readonly: true, active: true, list: 
			    			  [
                        <#list 0..(bean.tableList)?size-1! as i>
                            <#if i==0>
                                { type: "input",label: this.mlh.getDescr("H1", "${(bean.tableList)[i]}"),	name: "${(bean.tableList)[i]}",value: "",required: true,upperCase:true},//${bean.tableListDesc[i]}
                            </#if>
                            <#if i!=0>
                                <#if (bean.tableList)[i]?contains("warehouse")||(bean.tableList)[i]?contains("Warehouse")>
                                { type : "input",label : this.mlh.getDescr("H1","${(bean.tableList)[i]}"),name : "${(bean.tableList)[i]}",value : "",upperCase:true, useAddon: true, addonOptions: dialog_warehouseId}, //${bean.tableListDesc[i]}
                                <#elseif (bean.tableList)[i]?contains("activeFlag")>
                                <#elseif (bean.tableList)[i]?contains("birthday")||(bean.tableList)[i]?contains("date")||(bean.tableList)[i]?contains("Date")||(bean.tableList)[i]?contains("time")||(bean.tableList)[i]?contains("Time")>
                                { type : "input",label : this.mlh.getDescr("H1","${(bean.tableList)[i]}"),name : "${(bean.tableList)[i]}", value : "",useCalendar:true,calendarOptions:{dateFmt:'yyyy-MM-dd'}},//${bean.tableListDesc[i]}
                                <#elseif (bean.tableList)[i]?contains("Carrirer")||(bean.tableList)[i]?contains("carrier")||(bean.tableList)[i]?contains("Carrirer")>
                                { type : "input",label : this.mlh.getDescr("H1","${(bean.tableList)[i]}"),name : "${(bean.tableList)[i]}",value : "",upperCase:true, useAddon: true, addonOptions: initDialog_carrier}, //${bean.tableListDesc[i]}
                                <#elseif (bean.tableList)[i]?contains("customer")||(bean.tableList)[i]?contains("Customer")||(bean.tableList)[i]?contains("Customer")>
                                { type : "input",label : this.mlh.getDescr("H1","${(bean.tableList)[i]}"),name : "${(bean.tableList)[i]}",value : "",upperCase:true, useAddon: true, addonOptions: dialog_customerId}, //${bean.tableListDesc[i]}
                                <#else >
                                { type: "input",label: this.mlh.getDescr("H1", "${(bean.tableList)[i]}"),	name: "${(bean.tableList)[i]}",value: ""},//${bean.tableListDesc[i]}
                                </#if>
                            </#if>
                        </#list>
                        <#if (bean.tableListStr)?contains("activeFlag")>
                                {type : "checkbox",label : this.mlh.getDescr("H1","activeFlag"),name : "activeFlag", value : "",checked: true},//是否有效
                        </#if>
						]
			    			},
<#list (modelFormList)as modelBean>

                        //${modelBean.formName}
                        { type: "block", id: _this.namespace + "${modelBean.formName}Form", label: this.mlh.getText("${modelBean.formName}"),list:
                            [
                                <#list  0..(modelBean.formFieldList)?size-1 as k>
                                    <#if (modelBean.formFieldList)[k]?contains("birthday")||(modelBean.formFieldList)[k]?contains("date")||(modelBean.formFieldList)[k]?contains("Date")||(modelBean.formFieldList)[k]?contains("time")||(modelBean.formFieldList)[k]?contains("Time")>
                                { type: "input", label:this.mlh.getDescr("H1", "${((modelBean.formFieldList))[k]}"),	 name: "${((modelBean.formFieldList))[k]}", value: "",useCalendar:true,calendarOptions:{dateFmt:'yyyy-MM-dd HH:mm:ss'}},//${((modelBean.formFieldStrList))[k]}
                                    <#else >
                                    </#if>
                                { type: "input", label:this.mlh.getDescr("H1", "${((modelBean.formFieldList))[k]}"),	 name: "${((modelBean.formFieldList))[k]}", value: "" },//${((modelBean.formFieldStrList))[k]}
                                </#list>
                            ]
                        },

</#list>
                        //自定义
                        { type: "block", id: _this.namespace + "headerUdfForm", label: this.mlh.getText("udfInfo"),list:
                                [
                                    { type: "input", label:this.mlh.getDescr("H1", "udf01"),	 name: "udf01", value: "" },//自定义01
                                    { type: "input", label: this.mlh.getDescr("H1", "udf02"),	 name: "udf02", value: "" },//自定义02
                                    { type: "input", label: this.mlh.getDescr("H1", "udf03"),	 name: "udf03", value: "" },//自定义03
                                    { type: "input", label: this.mlh.getDescr("H1", "udf04"),	 name: "udf04", value: "" },//自定义04
                                    { type: "input", label:this.mlh.getDescr("H1", "udf05"),	 name: "udf05", value: "" },//自定义05
                                    { type: "input", label:this.mlh.getDescr("H1", "noteText"), name : "noteText",value : "",rows : "3",inputWidth : "col-sm-100"}
                                ]
                        },
                        //其他信息
                        { type: "block", id: _this.namespace + "headerOtherForm", label: this.mlh.getText("other"), list:
                                [
                                    { type: "input", label: this.mlh.getDescr("H1", "addWho"),   name: "addWho",   value: "",readonly: true},//新增人员
                                    { type: "input", label: this.mlh.getDescr("H1", "addTime"),  name: "addTime",  value: "",readonly: true},//新增时间
                                    { type: "input", label:this.mlh.getDescr("H1", "editWho"),  name: "editWho",  value: "",readonly: true},//编辑人员
                                    { type: "input", label:this.mlh.getDescr("H1", "editTime"), name: "editTime", value: "",readonly: true},//编辑时间
                                    { type: "input", label:this.mlh.getDescr("H1", "currentVersion"), name: "currentVersion", value: "",readonly: true},//编辑时间
                                    { type: "hidden",label:this.mlh.getDescr("H1", "oprSeqFlag"),name: "oprSeqFlag", value: "" ,readonly: true}//操作流水号
                                ]
                        }
			 ];
			this.format = [
				//{field:"creditAmount",formatType:"number",format:"000000000000000000.00"} , //18位保留2位小数
				//{field:"creditBalance",formatType:"number",format:"000000000000000000.00"}  //18位保留2位小数
			];
        }
    });
    return _Model;
});